# 构建boot 的jar包
FROM registry.cn-beijing.aliyuncs.com/easyxu/maven:3-jdk-11 as jbuild

WORKDIR /app

COPY ./pom.xml .
RUN mvn dependency:go-offline

COPY ./ .
RUN mvn clean package -Dmaven.test.skip=true

FROM registry.cn-beijing.aliyuncs.com/easyxu/oracle-jdk:11.0.12

RUN apt-get install -y apt-transport-https ca-certificates \
    && sed -i "s@http://ftp.debian.org@https://repo.huaweicloud.com@g" /etc/apt/sources.list \
    && sed -i "s@http://deb.debian.org@https://repo.huaweicloud.com@g" /etc/apt/sources.list \
    && sed -i "s@http://security.debian.org@https://repo.huaweicloud.com@g" /etc/apt/sources.list

RUN apt update -y &&  apt install -y  locales \
        && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen

ENV LANG "en_US.UTF-8"
ENV LANGUAGE en_US:en

COPY --from=jbuild /app/target/*.jar /app.jar

CMD ["java","-jar","/app.jar"]
